package com.wen.speingboot_thymeleaf_0510.controller;

import com.wen.speingboot_thymeleaf_0510.beans.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import sun.nio.cs.ext.MacDingbat;

import java.util.ArrayList;
import java.util.List;

@Controller
public class ThymeleafController {

    @RequestMapping("/login")
    public String indexHandle(Model model){
        model.addAttribute("welcome", "Hello xiaopam!");
        Student stu = new Student("lisi",23);
        Student stu1 = new Student("wa",22);
        Student stu2 = new Student("re",24);
        List<Student> list = new ArrayList<>();
        list.add(stu);
        list.add(stu1);
        list.add(stu2);
        model.addAttribute("list", list);

        model.addAttribute("student", stu);
        model.addAttribute("gender", "male");
        model.addAttribute("age", 45);
        return "index";
    }
}
